<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<style>
		#header {height: 30px;background: rgb(0, 51, 102);color: white;padding: 10px 15px 0 10px;}
		#header .logo {font-size: 22px;font-weight: bold;}
		#header .operate {float: right;display: inline-block;}
		#header .operate a {color: white;text-decoration: none;}
		#header .operate a:hover {text-decoration: underline;}
		#mainContent {margin: 5px 10px 15px 10px;}
		#nav {margin-bottom: -19px;}
		#footer {clear: both;border-top: 1px solid #cccccc;text-align: center;padding: 5px;}
		#footer span {float: right;margin-right: 20px;}
	</style>
</head>

<body>
	<div id="header">
		<span class="logo">PPM Bug Manage</span>
		<span class="operate"><a href="#"><sec:authentication property="name"/></a></span>
	</div>
	
	<div id="mainContent">
		<div id="nav">
			<ul class="nav nav-tabs">
				<li url="<c:url value="/pages/panel/panel.jsp" />" class="active"><a href="#">工作面板</a></li>
				<li url="<c:url value="/pages/project/project.jsp" />"><a href="#">项目状态</a></li>
				<li url="<c:url value="/pages/bug/bug.jsp" />"><a href="#">缺陷列表</a></li>
				<li url="<c:url value="/pages/account/account.jsp" />"><a href="#">用户管理</a></li>
			</ul>
		</div>
		
		<iframe id="mainFrame" name="mainFrame" src="" width="100%" 
			onload="autoHeight();" frameborder="0" style="border: 1px solid #ccc;border-top: 0;border-radius: 0 0 10px 10px;"></iframe>
	</div>
	
	<script>
		var basePath = "/open-bug/";
		
		$("#nav li").click(function() {
			$("#nav li").removeClass("active");
			$(this).addClass("active");
			
			$("#mainFrame").attr("src", $(this).attr("url"));
		});
	
		/**
		 * iframe 自适应高度
		*/
		function autoHeight() {
			var ifm = document.getElementById("mainFrame"); 
			var subWeb = document.frames ? document.frames["mainFrame"].document : ifm.contentDocument;
			
			if(ifm != null && subWeb != null) {
				var h = subWeb.body.scrollHeight;
				var minH = document.body.clientHeight - 100;
				
				ifm.height = h < minH ? minH : h; 
			} 
		}
	</script>
</body>
</html>
